package com.dongfa.learn_1101;

public class LearnCode1102 {
    public static void main(String[] args) {
        LearnCode1102 learnCode1102 = new LearnCode1102();
//        boolean isPalindrome = learnCode1102.isPalindromeNumber(123221);
//        System.out.println("该数字" + (isPalindrome ? "是" : "不是") + "回文数字");
//        int[] result = learnCode1102.getChu(100, 3);
//        System.out.println("商为：" + result[0] + "；余数为：" + result[1]);
        learnCode1102.numberIsSeven(100);
    }
    //验证一个整数是否为回文数字
    public boolean isPalindromeNumber(int num){
        String numChar = num + "";
        String newNumChar = new StringBuilder(numChar).reverse().toString();
        return numChar.equals(newNumChar);
    }
    //不使用乘除和取模，计算除法所得的商和余数
    public int[] getChu(int divided, int divisor){
        int quotient = 0;
        int remainder = 0;
        while((divided - divisor >=0)){
            divided = divided - divisor;
            quotient++;
        }
        remainder = divided;
        return new int[]{quotient, remainder};
    }
    //逢7过，包含7，以及7的倍数
    public void numberIsSeven(int num){
//        String newNum = String.valueOf(num);
        while (num > 6){
            String newNum = num + "";
            if (newNum.contains("7") | num % 7 == 0){
                System.out.println("这个数字应该跳过，" + newNum);
            }else {
                newNum = String.valueOf(num);
            }
            num--;
        }
    }
}
